<%--
 * list.jsp
 *
 * Copyright (C) 2013 Universidad de Sevilla
 * 
 * The use of this project is hereby constrained to the conditions of the 
 * TDG Licence, a copy of which you may download from 
 * http://www.tdg-seville.info/License.html
 --%>

<%@page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>

<%@taglib prefix="jstl" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@taglib prefix="security"
	uri="http://www.springframework.org/security/tags"%>
<%@taglib prefix="display" uri="http://displaytag.sf.net"%>
<%@taglib prefix="acme" tagdir="/WEB-INF/tags"%>

<display:table pagesize="5" class="displaytag" keepStatus="true"
	name="customers" requestURI="${requestURI}" id="row">

	<spring:message code="customer.name" var="nameHeader" />
	<display:column property="name" title="${nameHeader}" sortable="false" />

	<spring:message code="customer.surname" var="surnameHeader" />
	<display:column property="surname" title="${surnameHeader}"
		sortable="false" />

	<spring:message code="customer.email" var="emailHeader" />
	<display:column property="email" title="${emailHeader}"
		sortable="false" />

	<security:authorize access="isAnonymous()">
		<display:column>
			<a href="painting/list.do?customerId=${row.id}"><spring:message
					code="customer.paintingList" /></a>
		</display:column>

		<display:column>
			<a href="gallery/list.do?customerId=${row.id}"><spring:message
					code="customer.galleryList" /></a>
		</display:column>
	</security:authorize>

	<security:authorize access="hasRole('ADMINISTRATOR')">
		<display:column>
			<a href="painting/administrator/list.do?customerId=${row.id}"><spring:message
					code="customer.paintingList" /></a>
		</display:column>

		<display:column>
			<a href="gallery/administrator/list.do?customerId=${row.id}"><spring:message
					code="customer.galleryList" /></a>
		</display:column>
	</security:authorize>
</display:table>

<acme:cancel code="customer.goBack" url="${backURI}" />